package DB.Dao.RepairWork;

import java.sql.Timestamp;
import java.util.Date;

import DB.Dao.BreakDown.BreakDown;
import DB.Dao.RepairStatus.*;
import DB.Dao.RepairStatus.RepairStatus.RepairStatusItem;

/**
 * RepairWork entity. @author MyEclipse Persistence Tools
 */

public class RepairWork implements java.io.Serializable {

	// Fields

	private Integer repairWorkId;
	private Integer breakId;
	private String workName;
	private String workContent;
	private String workRecord;
	private Integer repairStatue;
	private Timestamp addTime;

	// Constructors

	/** default constructor */
	public RepairWork() {
	}

	public String getWorkRecord() {
		return workRecord;
	}

	public void setWorkRecord(String workRecord) {
		this.workRecord = workRecord;
	}

	/** minimal constructor */
	public RepairWork(Integer repairWorkId) {
		this.repairWorkId = repairWorkId;
	}

	/** full constructor */
	public RepairWork(Integer repairWorkId, Integer breakId, String workName,
			String workContent,String workRecord, Integer repairStatue, Timestamp addTime) {
		this.repairWorkId = repairWorkId;
		this.breakId = breakId;
		this.workName = workName;
		this.workContent = workContent;
		this.workRecord=workRecord;
		this.repairStatue = repairStatue;
		this.addTime = addTime;
	}

	// Property accessors

	public Integer getRepairWorkId() {
		return this.repairWorkId;
	}

	public void setRepairWorkId(Integer repairWorkId) {
		this.repairWorkId = repairWorkId;
	}

	public Integer getBreakId() {
		return this.breakId;
	}

	public void setBreakId(Integer breakId) {
		this.breakId = breakId;
	}

	public String getWorkName() {
		return this.workName;
	}

	public void setWorkName(String workName) {
		this.workName = workName;
	}

	public String getWorkContent() {
		return this.workContent;
	}

	public void setWorkContent(String workContent) {
		this.workContent = workContent;
	}

	public Integer getRepairStatue() {
		return this.repairStatue;
	}

	public void setRepairStatue(Integer repairStatue) {
		this.repairStatue = repairStatue;
	}

	public Timestamp getAddTime() {
		return this.addTime;
	}

	public void setAddTime(Timestamp addTime) {
		this.addTime = addTime;
	}
	public void add2DB(int breakdownId){
		this.setBreakId(1);
		Timestamp time=new Timestamp( new Date().getTime());
		this.setAddTime(time);
		this.setRepairStatue(RepairStatusItem.NewRepair.id);
		RepairWorkDAO dao=new RepairWorkDAO();
		dao.save(this);
	}
	public void up2DB(){
		RepairWorkDAO dao=new RepairWorkDAO();
		dao.attachDirty(this);
	}
	

}